package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.product.entity.BaseCategory1;
import com.atguigu.gmall.product.mapper.BaseCategory1Mapper;
import com.atguigu.gmall.product.service.BaseCategory1Service;
import com.atguigu.gmall.product.vo.CategoryTreeVo;
import com.atguigu.gmall.product.vo.CategoryViewDTO;
import com.atguigu.gmall.starter.cache.aspect.annotation.MallCache;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 10574
* @description 针对表【base_category1(一级分类表)】的数据库操作Service实现
* @createDate 2022-11-29 17:33:22
*/
@Service
public class BaseCategory1ServiceImpl extends ServiceImpl<BaseCategory1Mapper, BaseCategory1>
    implements BaseCategory1Service{

    @Override
    @MallCache(cacheKey = "categorys")
    public List<CategoryTreeVo> getCategoryTree() {
        List<CategoryTreeVo> categoryTreeVos=baseMapper.getCategoryTree();
        return categoryTreeVos;
    }

    @Override
    public CategoryViewDTO getCategoryTreeWithC3Id(Long c3Id) {
        CategoryViewDTO categoryViewDTO=baseMapper.getCategoryTreeWithC3Id(c3Id);
        return categoryViewDTO;
    }
}




